GetValue - JSONObject

Note: This statement is not available in the Add Statement dialog box or the Statements pane.

Returns the value of a property in a JSONObject or a default value if the property name is not found.

Syntax

GetValue("PropertyName", DefaultReturnValue)

Arguments

Argument Description
PropertyName Property in the JSONObject.
DefaultReturnValue Value to return if the property name is not found. If not specified, the default value is null.

Supported objects

JSONObject

Return value

Value Description
Value JSONObject property value. The DefaultReturnValue is returned if the property name is not found.

Example

jsonObject = JSONNewObject()

' Adds values to JSONObject

jsonObject.SetValue("PropertyName1", 1)

jsonObject.SetValue("PropertyName2", 2)

' Returns 2

intVal = jsonObject.GetValue("PropertyName2")

PrintLn("Should be 2: " & intVal)